package org.example.session;

import org.dom4j.DocumentException;
import org.example.Configuration;
import org.example.XMLConfigBuilder;

public class SqlSessionFactoryBuilder {


    public SqlSessionFactory build(String resource) {
        XMLConfigBuilder configBuilder = new XMLConfigBuilder(resource);
        try {
            Configuration parse = configBuilder.parse();
            return new DefaultSqlSessionFactory(parse);
        } catch (DocumentException e) {
            throw new RuntimeException("解析配置文件失败");
        }
    }

}
